<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<!--标准mui.css-->
		<link rel="stylesheet" href="css/mui.min.css">
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="css/app.css" />
		<style>
			h5 {
				margin: 5px 7px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">取消布控</h1>
			<button id="savebkr" type="button" class="mui-left mui-btn mui-btn-link mui-btn-nav mui-pull-right">
					保存
				</button>
		</header>
		<div class="mui-content">
			<div class="mui-content-padded" style="margin: 5px;">
				<div class="mui-input-group">
					<div class="mui-input-row">
						<div class="mui-input-row">
							<label>审核人</label>
							<div class="mui-scroll">
								<ul class="mui-table-view" id="weibk">
								</ul>
							</div>
						</div>

					</div>

				</div>
				<div class="mui-input-row" style="margin: 10px 5px;">
					<textarea id="bz" rows="5" placeholder="请输入备注" style="margin-bottom: 0;"></textarea>
				</div>
				<script src="js/mui.min.js"></script>
				<script src="js/jquery.min.js"></script>
				<script src="js/config.js"></script>
				<script type="text/javascript">
					mui.init({
						swipeBack: true //启用右滑关闭功能
					});
					mui.plusReady(function() {
						var self = plus.webview.currentWebview();
						//					var myid = self.mainid;
						var shld = localStorage.getItem("shld");
						var adminuser = JSON.parse(localStorage.adminuser);
						var obj = null;
						weibkfun();
						$(function() {
							if(typeof(myid) != 'undefined') {
								$.get(dataDomain + "/dc/info/" + myid, function(req) {
									obj = req;

									$("#bz").val(req.remark);
									$("#idstr").val(req.idstr);
									setids(req.alarmIds);
								});
							}
							$("#savebkr").on("tap", function() {
								var arr = $(".mui-checkbox input[type='checkbox']:checkbox:checked");
								var idstrauditers = "";
								arr.each(function() {
									var myid = $(this).attr("myid");
									idstrauditers += myid + ",";
								});

								var bz = $("#bz").val();
								if(arr.length <= 0) {
									mui.alert("未选择提交项");
									return false;
								}
								var idstr = localStorage.getItem("idstr");

								if(bz == '') {
									mui.alert("请输入备注");
									return false;
								}

								$.ajax({
									type: "POST",
									url: dataDomain + "/dc/info/close",
									data: {
										ids: idstr,
										remark: bz
									},
									async: true,
									success: function(req) {
										if(req.status == 'ok') {
											mui.toast("提交成功");
											setTimeout(function() {
												plus.webview.currentWebview().close();
											}, 1000);
										} else {
											mui.toast("提交失败，请稍候再试");
										}
									}
								});

							});
						});
					});
					//
					function weibkfun() {
						$.get(dataDomain + "/common/auditusers", function(req) {
							if(req.length > 0) {
								var htm = '';
								for(var i = 0; i < req.length; i++) {
									htm += '<li class="mui-table-view-cell mui-left">';
									htm += '审核人<span style="padding-left:30px;" class="mui-table-view-cell mui-checkbox mui-left"><input style="left:10px;" myid="' + req[i].value + '" type="checkbox" /></span><span myid="' + req[i].value + '" class="view-detail1">' + req[i].text;
									htm += '</span></li>';
								}
								$("#weibk").html(htm);
							}
						})
					}
				</script>
	</body>

</html>